package com.cxf.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.cxf.service.UserService;
import com.cxf.service.impl.UserServiceImpl;

@WebServlet("/add")
public class Opration extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		
		UserService userService = new UserServiceImpl();
		userService.addMessage(1, req.getParameter("info"));
		for (String s:userService.getAllMessage()) {
			resp.getWriter().append(s+"\n");
		}
		//resp.sendRedirect("/Message/page/messageBoard.html");
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		super.doDelete(req, resp);
	}
}
